-
Notifications
You must be signed in to change notification settings - Fork 2.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix currency breaking issue with currency conversion #43133
Conversation
@ahmedGaber93 Please copy/paste the Reviewer Checklist from here into a new comment on this PR and complete it. If you have the K2 extension, you can simply click: [this button] |
I'll update the recordings shortly. |
@ahmedGaber93 can you take latest pull from main and execute the Onyx.merge command on a IOU report please? I'm getting the following error, wanted to know if it's because of my commits or it's on latest itself.
|
@b4s36t4 I don't think this related to your PR. |
Thanks for checking @ahmedGaber93 . |
@ahmedGaber93 Please go ahead with your review and testing. I have uploaded the videos as well (except android chrome, setting up ssl certificated would be done soon).
|
@b4s36t4 I think you missed those two places Line 2897 in afe64e5
Line 2919 in afe64e5
Also why typescript not catch this? |
because Although typescript doesn't catch this I had a validation condition inside the function which will catch there even if we miss here. |
bc69faf
to
26f5d45
Compare
@ahmedGaber93 please check now updated, sorry for missing it out!. |
App/src/types/onyx/Currency.ts Line 24 in fcfef92
Yes, |
src/libs/CurrencyUtils.ts
Outdated
let validatedCurrency = currency; | ||
if (!currency || currency.length === 0 || currency.length > 3) { | ||
validatedCurrency = CONST.CURRENCY.USD; | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we can simplify this condition to !currency
and this will check for undefined
or ''
let currencyWithFallback = currency;
if (!currency) {
currencyWithFallback = CONST.CURRENCY.USD;
}
Also, I think it is self-explanatory
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yea, but my idea is to make it explain the value shouldn't be empty string as well.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yea, but my idea is to make it explain the value shouldn't be empty string as well.
Ok, we can simplify the comment, maybe like this // Fallback currency to USD if it empty string or undefined
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done, updated.!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@b4s36t4 I think this syntax is better than the new one you pushed
let currencyWithFallback = currency;
if (!currency) {
currencyWithFallback = CONST.CURRENCY.USD;
}
@b4s36t4 I think we need to simplify Tests to
|
Agree, updating.! |
@b4s36t4 We still need to update #43133 (comment) and #43133 (comment). Thanks for your patience. |
This comment was marked as outdated.
This comment was marked as outdated.
Reviewer Checklist
Screenshots/VideosAndroid: Nativea.mp4Android: mWeb Chromeaw.mp4iOS: Nativeios.mp4iOS: mWeb Safariiw.mp4MacOS: Chrome / Safari20240606012640236.mp4MacOS: Desktopd.mp4 |
@b4s36t4 this issue is urgent, are you able to update this #43133 (comment) today? |
@ahmedGaber93 Sorry I went to sleep at that time. I have updated the changes you requested can you please check again? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
code looks good and tests well, thanks for the quick changes
QA, if you're not able to follow the test steps (deals with the browser console), please tag me and I can help QA it. |
✋ This PR was not deployed to staging yet because QA is ongoing. It will be automatically deployed to staging after the next production release. |
🚀 Deployed to production by https://github.com/luacmartins in version: 1.4.81-11 🚀
|
Details
Fixed Issues
$ #43004
PROPOSAL: #43004 (comment)
Tests
Maybe a technical testing is required than manual QA
Onyx.merge("report_<your_report_id>",{currency: null})
then press Enter. You can getyour_report_id
from browser link.Offline tests
Same as above
QA Steps
Same as Above
PR Author Checklist
### Fixed Issues
section aboveTests
sectionOffline steps
sectionQA steps
sectiontoggleReport
and notonIconClick
)myBool && <MyComponent />
.src/languages/*
files and using the translation methodSTYLE.md
) were followedAvatar
, I verified the components usingAvatar
are working as expected)StyleUtils.getBackgroundAndBorderStyle(theme.componentBG)
)Avatar
is modified, I verified thatAvatar
is working as expected in all cases)Design
label and/or tagged@Expensify/design
so the design team can review the changes.ScrollView
component to make it scrollable when more elements are added to the page.main
branch was merged into this PR after a review, I tested again and verified the outcome was still expected according to theTest
steps.Screenshots/Videos
Android: Native
Kapture.2024-06-06.at.01.21.00.mp4
Android: mWeb Chrome
Kapture.2024-06-06.at.01.45.31.mp4
iOS: Native
Kapture.2024-06-06.at.00.49.17.mp4
iOS: mWeb Safari
Kapture.2024-06-06.at.01.02.36.mp4
MacOS: Chrome / Safari
Kapture.2024-06-05.at.21.43.29.mp4
MacOS: Desktop
Kapture.2024-06-05.at.22.21.38.mp4